package com.dyoud.api.shop.controller;

import javax.annotation.Resource;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.dyoud.api.ReturnInfo;
import com.dyoud.api.shop.service.ShopPicApiService;
import com.dyoud.api.shop.shopInfo.dto.ShopPicDto;
import com.dyoud.core.ResponseBean;

@RestController
@RequestMapping("shopPic")
public class ShopPicController {

    @Resource
    private ShopPicApiService shopPicApiService;
    
    /***
     * 添加 店铺图片
     * 
     * @param shopPic
     * @return
     */
    @RequestMapping(value="",method=RequestMethod.POST)
    public ResponseBean addShopPic(@RequestBody @Validated ShopPicDto dto) {
        boolean b = shopPicApiService.addShopPic(dto);
        if(!b) {
            return new ResponseBean().fail(ReturnInfo.ADD_SHOP_PIC_CODE,ReturnInfo.ADD_SHOP_PIC_CODE);
        }
        return new ResponseBean().success(b);
    }
}
